
#ifndef VERSION_HPP
#define VERSION_HPP

#include <cstdint>
#include <string>

#ifdef __linux__
#undef major
#undef minor
#endif

typedef struct Version
{
    uint32_t version{};

    Version() = default;
    explicit Version(uint32_t v) : version(v) {}
    Version(uint32_t major, uint32_t minor, uint32_t micro) : version(major * 1'000'000 + minor * 1000 + micro) {}

    [[nodiscard]] uint32_t major() const { return version / 1'000'000; }
    [[nodiscard]] uint32_t minor() const { return (version / 1000) % 1000; }
    [[nodiscard]] uint32_t micro() const { return version % 1000; }

    [[nodiscard]] std::string toString() const
    {
        std::string str;
        str += std::to_string(major());
        str += '.';
        str += std::to_string(minor());
        str += '.';
        str += std::to_string(micro());
        return str;
    };
} Version;

#endif /** VERSION_HPP */